<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>示例10</title>
    <script>
        //下面是代码 1 部分------ 
        let s = new Set();
        [1, 1, 2, 3, 4, 4].forEach(x => s.add(x));
        for (let i of s) {
            console.log(i)
        }
        //下面是代码 2 部分--------------- 
        let set1 = new Set([1, 1, 2, 3, 4, 4])
        console.log(set1);
        //下面是代码 3 部分---- 
        let arr1 = [1, 2, 3];
        let arr2 = [2, 3, 4, 5];
        let set2 = new Set([...arr1, ...arr2])
        console.log(set2)
        //下面是代码 4 部分---------------- 
        console.log([...new Set('ababbc')].join(''));
    </script>
</head>

<body></body>

</html>